/**
* @Author: 858834013@qq.com
* @Name: DateFormat
* @Date: 2022-01-16
* @Desc: 日期格式化
*/
<template>
  <div>
    {{ dataTime }}
  </div>
</template>

<script>
import moment from 'moment'

export default {
  name: 'DateFormat',
  components: {},
  props: {
    date: {
      type: String | Number,
      default() {
        return ''
      }
    },
    format: {
      type: String,
      default() {
        return 'YYYY-MM-DD HH:mm:ss'
      }
    }
  },
  computed: {
    dataTime: function() {
      var dataTime = ''
      if (this.date) {
        dataTime = moment(this.date).format(this.format)
      }
      return dataTime
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
